﻿using System.Collections.Generic;

namespace com.binance.client.model.enums
{
	public sealed class TransactType
	{

	  public static readonly TransactType TRADE = new TransactType("TRADE", InnerEnum.TRADE, "trade");
	  public static readonly TransactType ETF = new TransactType("ETF", InnerEnum.ETF, "etf");
	  public static readonly TransactType TRANSACT_FEE = new TransactType("TRANSACT_FEE", InnerEnum.TRANSACT_FEE, "transact-fee");
	  public static readonly TransactType FEE_DEDUCTION = new TransactType("FEE_DEDUCTION", InnerEnum.FEE_DEDUCTION, "fee-deduction");
	  public static readonly TransactType TRANSFER = new TransactType("TRANSFER", InnerEnum.TRANSFER, "transfer");
	  public static readonly TransactType CREDIT = new TransactType("CREDIT", InnerEnum.CREDIT, "credit");
	  public static readonly TransactType LIQUIDATION = new TransactType("LIQUIDATION", InnerEnum.LIQUIDATION, "liquidation");
	  public static readonly TransactType INTEREST = new TransactType("INTEREST", InnerEnum.INTEREST, "interest");
	  public static readonly TransactType DEPOSIT = new TransactType("DEPOSIT", InnerEnum.DEPOSIT, "deposit");
	  public static readonly TransactType WITHDRAW = new TransactType("WITHDRAW", InnerEnum.WITHDRAW, "withdraw");
	  public static readonly TransactType WITHDRAW_FEE = new TransactType("WITHDRAW_FEE", InnerEnum.WITHDRAW_FEE, "withdraw-fee");
	  public static readonly TransactType EXCHANGE = new TransactType("EXCHANGE", InnerEnum.EXCHANGE, "exchange");
	  public static readonly TransactType OTHER_TYPES = new TransactType("OTHER_TYPES", InnerEnum.OTHER_TYPES, "other-types");

	  private static readonly IList<TransactType> valueList = new List<TransactType>();

	  static TransactType()
	  {
		  valueList.Add(TRADE);
		  valueList.Add(ETF);
		  valueList.Add(TRANSACT_FEE);
		  valueList.Add(FEE_DEDUCTION);
		  valueList.Add(TRANSFER);
		  valueList.Add(CREDIT);
		  valueList.Add(LIQUIDATION);
		  valueList.Add(INTEREST);
		  valueList.Add(DEPOSIT);
		  valueList.Add(WITHDRAW);
		  valueList.Add(WITHDRAW_FEE);
		  valueList.Add(EXCHANGE);
		  valueList.Add(OTHER_TYPES);
	  }

	  public enum InnerEnum
	  {
		  TRADE,
		  ETF,
		  TRANSACT_FEE,
		  FEE_DEDUCTION,
		  TRANSFER,
		  CREDIT,
		  LIQUIDATION,
		  INTEREST,
		  DEPOSIT,
		  WITHDRAW,
		  WITHDRAW_FEE,
		  EXCHANGE,
		  OTHER_TYPES
	  }

	  public readonly InnerEnum innerEnumValue;
	  private readonly string nameValue;
	  private readonly int ordinalValue;
	  private static int nextOrdinal = 0;
	  private readonly string code;

	  internal TransactType(string name, InnerEnum innerEnum, string code)
	  {
		this.code = code;

		  nameValue = name;
		  ordinalValue = nextOrdinal++;
		  innerEnumValue = innerEnum;
	  }

	  public string Code
	  {
		  get
		  {
			return code;
		  }
	  }

	  public static TransactType find(string code)
	  {
		foreach (TransactType transactType in TransactType.values())
		{
		  if (transactType.Code.Equals(code))
		  {
			return transactType;
		  }
		}
		return null;
	  }


		public static IList<TransactType> values()
		{
			return valueList;
		}

		public int ordinal()
		{
			return ordinalValue;
		}

		public override string ToString()
		{
			return nameValue;
		}

		public static TransactType valueOf(string name)
		{
			foreach (TransactType enumInstance in TransactType.valueList)
			{
				if (enumInstance.nameValue == name)
				{
					return enumInstance;
				}
			}
			throw new System.ArgumentException(name);
		}
	}

}